#include "junix.h"
using namespace std;

int main(int argc, char **argv)
{
	auto_ptr<int> pi(new int(88));
	cout<<*pi<<endl;

	auto_ptr<int> pi2=pi;
	cout<<*pi2<<endl;
//	cout<<*pi<<endl;
//
    auto_ptr<int> pi3(pi2);
	cout<<*pi3<<endl;
	
	pi=pi3;
//	cout<<*pi3<<endl;

	*pi =99;
	cout<<*pi<<endl;

	auto_ptr<int> pi4(new int(1234));
	*pi = *pi4;
	cout<<*pi<<endl;
	cout<<*pi4<<endl;

	//*pi3 = 99;

	auto_ptr<int>::element_type a=9;
	cout<<a<<endl;
	cout<<pi.get()<<endl;

	assert( pi.get()== &*pi );
}
